#!/bin/bash

ConfigDir=$TEST_DIR/../../../../../../Examples/Speech/Miscellaneous/TIMIT/config

# This test uses a large dataset which is not part of the CNTK repository itself
# We use the dataset from an external location specified using an environment variable
if [[ "$CNTK_EXTERNAL_TESTDATA_SOURCE_DIRECTORY" == "" || ! -d "$CNTK_EXTERNAL_TESTDATA_SOURCE_DIRECTORY" ]]; then
    echo 'This test uses external data that is not part of the CNTK repository. Environment variable CNTK_EXTERNAL_TESTDATA_SOURCE_DIRECTORY must be set to point to the external test data location'
    exit 1
fi

if [ "$OS" == "Windows_NT" ]; then
    DataSourceDir=`cygpath -au $CNTK_EXTERNAL_TESTDATA_SOURCE_DIRECTORY`/Speech/ASR
else
    DataSourceDir=$CNTK_EXTERNAL_TESTDATA_SOURCE_DIRECTORY/Speech/ASR
fi

# We do not copy the data locally, simply pointing it to the data directory.
DataDir=$DataSourceDir

# Set the required parameters for the configuration
if [ "$OS" == "Windows_NT" ]; then
    ConfigDir=$(cygpath -aw $ConfigDir)
    ExpDir=$(cygpath -aw $RunDir)/exp
    ScpDir=$(cygpath -aw $DataDir)
    MlfDir=$(cygpath -aw $DataDir)
else
    ExpDir=$RunDir/exp
    ScpDir=$DataDir
    MlfDir=$DataDir
fi

DeviceNumber=$CNTKDeviceId
LibDir=$ConfigDir/../lib

CntkArguments="LibDir=$LibDir ScpDir=$ScpDir MlfDir=$MlfDir NdlDir=$ConfigDir MelDir=$ConfigDir ExpDir=$ExpDir DeviceNumber=$DeviceNumber"
